package cc.marcio.systems.seven.dao;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Expression;

import cc.marcio.systems.seven.model.Planet;


@SuppressWarnings("serial")
public class PlanetDao extends BaseDaoImpl<Planet> implements BaseDao<Planet> {

	protected PlanetDao(Session session) {
		super(session);
	}

	@Override
	protected void addPropertiedToCriteria(Criteria criteria, Planet example) {
		if( example.getId() != null ) {
			if( example.getId().getUser() != null ) {
				criteria.add(Expression.eq("id.user", example.getId().getUser()));
			}
			if( example.getId().getRound() != null ) {
				criteria.add(Expression.eq("id.round", example.getId().getRound()));
			}
		}
	}
}
